home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection 1998 Fall: Game Toolkit / Disc.iso / SDKs / Apple Game Sprockets / InputSprocket / Sample Drivers / Common Driver Code / ResourceUtils.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-07-14  |  2.3 KB  |  94 lines  |  [TEXT/CWIE]

  1. /*************************************************************************************
  2.  
  3. File:      ResourceUtils.h
  4.  
  5. Copyright © 1996, 1997, 1998 Apple Computer, Inc., All Rights Reserved
  6.  
  7.  
  8. You may incorporate this sample code into your applications without
  9. restriction, though the sample code has been provided "AS IS" and the
  10. responsibility for its operation is 100% yours.  However, what you are
  11. not permitted to do is to redistribute the source as "DSC Sample Code"
  12. after having made changes. If you're going to re-distribute the source,
  13. we require that you make it clear in the source that the code was
  14. descended from Apple Sample Code, but that you've made changes.
  15.  
  16. *************************************************************************************/
  17.  
  18. #ifndef __RESOURCEUTILS__
  19. #define __RESOURCEUTILS__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h> 
  23. #endif
  24.  
  25. #ifndef __ICONS__
  26. #include <Icons.h>
  27. #endif
  28.  
  29. void Resource_GetIndString(short inResourceId, UInt32 inIndex, SInt16 inDestSize, StringPtr outString, OSStatus *error);
  30. void Resource_GetString(short inResourceId, SInt16 inDestSize, StringPtr outString, OSStatus *error);
  31.  
  32. /*
  33.  * Resource_Copy
  34.  *
  35.  * copies a resource from one resource file to another
  36.  * in the process it releases the original resource.
  37.  * 
  38.  */
  39.  
  40. void Resource_Copy(short inFromRef, short inFromID, ResType inType, short inToRef, short inToID, OSStatus *error);
  41.  
  42. /*
  43.  *
  44.  * Resource_Get1IconSuite
  45.  *
  46.  * Gets a icon suite from the current resource file
  47.  *
  48.  * In the process it detaches and makes all the handle non purgable.
  49.  *
  50.  */
  51.  
  52. Handle Resource_Get1IconSuite(short inResourceId, IconSelectorValue inSelector, OSStatus *error);
  53.  
  54. /*
  55.  *
  56.  * Resource_CleanResHandle
  57.  *
  58.  * takes a resource handle, detaches it and makes it non purgable
  59.  * assumes that this is a valid resource handle whose resChange bit
  60.  * is not set
  61.  *
  62.  */
  63.   
  64. void Resource_CleanResHandle(Handle inResourceHandle);
  65.  
  66. /*
  67.  *
  68.  * Resource_Delete1
  69.  *
  70.  *
  71.  * delete a resource by id and type
  72.  *
  73.  */
  74.  
  75. void Resource_Delete1(ResType inType, short inID, OSStatus *err);
  76.  
  77.  
  78.  
  79. class    StCurResFileState {
  80. public:
  81.                 StCurResFileState(void);
  82.                 StCurResFileState(short inNewCurResFile);    // sets the cur res file to inNewPort
  83.  
  84.                 ~StCurResFileState(void);
  85.                 
  86.     void        Save();
  87.     void        Restore();
  88.     
  89. private:
  90.     short mResFileRefNum;
  91. };
  92.  
  93.  
  94. #endif // __RESOURCEUTILS__